<template>
    <div class="tab1" v-for="(item, index) of companyApplyList" :key="index">
        <div class="company" @click="jump({ path: '/CompanyApproveDetail', query: { applyId: item.applyId } })">
            <div class="box">
                <div class="dv1">
                    <div class="company-logo">{{ removeAndSubstring(item.companyName) }}</div>
                </div>
                <div class="dv2">
                    <span class="sp1">{{item.companyName}}</span>
                    <span class="sp2">{{item.uscc}}</span>
                </div>
                <div class="dv3">
                    <div class="name2">{{timestampToYMD(item.creatorTime)}}</div>
                    <div class="sh-status ysh" v-if="item.auditStatus == '已审核'">{{item.auditStatus}}</div>
                    <div class="sh-status wsh" v-if="item.auditStatus == '未审核'">{{item.auditStatus}}</div>
                    <div class="sh-status th"  v-if="item.auditStatus == '退回'">{{item.auditStatus}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref, watch, toRefs, onMounted } from 'vue';
import { getTalentList } from '@/api/company.js';
import { useRouter } from 'vue-router';
import { showToast } from 'vant';
const router = new useRouter();

const props = defineProps({
    companyApplyList: { type: Object, default: () => ({}) }
})

function timestampToYMD(timestamp) {
  const dateObj = new Date(timestamp);
  const year = dateObj.getFullYear();
  const month = dateObj.getMonth() + 1; // 月份是从0开始计数的，所以要加1
  const day = dateObj.getDate();
  
  return year + '-' + month + '-' + day;
}

const jump = (options) => {
  router.push(options);
}
//公司logo截取名称
function removeAndSubstring(str) {
  const result = str.replace(new RegExp('^.*?' + '市', ''), '');
  return result.substring(0, 4);
}


onMounted(() => {
    // getTalent()
})

</script>

<style lang="scss" scoped>
.tab1{
    padding: 1.2rem;
    background: #fff;
    display: flex;
    align-items: flex-start;
    justify-content:flex-start;
    margin: 1.2rem;
}
.company{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}
.box{
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.dv1{
    margin-right: 1rem;

    img{
        width: 5.6rem;
    }
}
.dv2{
    .sp1{
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 0.9rem;
    }
    .sp2{
        font-size: 1.4rem;
        font-weight: 400;
    }
}
.dv3{
    color: #666666;
    font-size: 1.4rem;
    font-weight: 400;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    
    .name2{
        font-size: 1.4rem;
        font-weight: 400;
        margin-bottom: 0.6rem;
        color: #666666;
    }

    .sh-status{
        width: 5.4rem;
        height: 2.7rem;
        line-height: 2.7rem;
        background: rgba(255, 141, 26, 0.2);
        color: #FF8D1A;
        text-align: center;
        margin-top: 2.5rem;
    }
    .ysh{
        background: rgba(255, 141, 26, 0.2);
        color: #FF8D1A;
    }
    .wsh{
        background: rgba(0, 186, 173, 0.2);;
        color: #00BAAD;
    }
    .th{
        background: rgba(121, 72, 234, 0.2);
        color: #7948EA;
    }
}

.company-logo{
    width: 5rem;
    height: 5rem;
    margin-right: 1rem;
    border-radius: 5px;
    background: #5693FC;
    font-size: 1.8rem;
    font-weight: 400;
    color: #fff;
    text-align: center;
}
</style>